package com.fxnotes.common.ui;

import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Parent;

public class ModuleController extends Controller <Controller>  {

    protected SimpleObjectProperty<Parent> objectProperty = new SimpleObjectProperty<>();

    public ModuleController(String name) {
        super(name);
    }

    protected void setCurrentNodePresenter(NodePresenter<Parent> currentNodePresenter) {
        onPresenterChanged(currentNodePresenter);
    }

    public Property<? extends Parent> getProperty() {
        return objectProperty;
    }

    @Override
    protected void onControllerChanged(Controller module) {
    }

    @Override
    protected void onPresenterChanged(NodePresenter<Parent> nodePresenter) {
        objectProperty.set(nodePresenter.getNode());
    }
}
